﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETA.IRepository;
using ETA.IService;

namespace ETA.Service
{
    public class RegistrationEducationService : IRegistrationEducationService
    {
        #region 属性

        private IRegistrationEducationRepository _IRegistrationEducationRepository { set; get; }


        #endregion

        #region 构造函数

        public RegistrationEducationService(IRegistrationEducationRepository IRegistrationEducationRepository)
        {
            _IRegistrationEducationRepository = IRegistrationEducationRepository;
        }

        #endregion

        #region IRegistrationEducationService 成员

        public CreateRegistrationEducationResponse CreateRegistrationEducation(CreateRegistrationEducationRequest req)
        {
            var res = new CreateRegistrationEducationResponse();
            try
            {
                if (req != null)
                {
                    _IRegistrationEducationRepository.Insert(req.RegistrationEducation);
                    res.Result.IsSuccess = true;
                }
            }
            catch (Exception e)
            {
                res.Result.IsSuccess = false;
                res.Result.ErrMessage = e.Message;
            }
            return res;
        }

        public ModifyRegistrationEducationResponse ModifyRegistrationEducation(ModifyRegistrationEducationRequest req)
        {
            var res = new ModifyRegistrationEducationResponse();
            try
            {
                if (req != null)
                {
                    _IRegistrationEducationRepository.Update(req.RegistrationEducation);
                    res.Result.IsSuccess = true;
                }
            }
            catch (Exception e)
            {
                res.Result.IsSuccess = false;
                res.Result.ErrMessage = e.Message;
            }
            return res;
        }

        #endregion
    }
}
